Skip to content

Comments

Fredegrec container#101

Open
fredegrec wants to merge 22 commits intoarhangeldim:masterfrom
fredegrec:fredegrec-container
Open

Fredegrec container#101
fredegrec wants to merge 22 commits intoarhangeldim:masterfrom
fredegrec:fredegrec-container

Conversation

@fredegrec
Copy link

No description provided.

private List<Bean> beans;
private Map<String, Bean> beanById;
private Map<String, Bean> beanByClassName;
private Map<String, Object> objByClassName;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

зачем?

*/
public Object getById(String id) {
return null;
public Object getById(String id) throws ClassNotFoundException, IllegalAccessException, InstantiationException,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Слишком сложная сигнатура, как этим методом пользоваться будем? Давайте бросать какое-то одно кастомное исключение на все ошибки

public Object getById(String id) throws ClassNotFoundException, IllegalAccessException, InstantiationException,
InvalidConfigurationException, InvocationTargetException, NoSuchFieldException, NoSuchMethodException {
if (beanById.containsKey(id)) {
Bean bean = beanById.get(id);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

так его можно и вернуть?

} else {
value = getByClass(field.getType().getName());
}
field.set(object, value);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В задании нужно сделать через метод setField()

*/
public Object getByClass(String className) {
return null;
public Object getByClass(String className) throws ClassNotFoundException, IllegalAccessException,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ТОже с сигнатурой


private Object stringToPrimitive(Type type, String value) {
switch (type.getTypeName()) {
case ("byte") : return Byte.parseByte(value);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А если Byte/Integer/Long?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants